﻿@using Smartstore.Web.Models.Catalog

@model ProductDetailsModel

@{
    var hasSpecificationAttributes = Model.SpecificationAttributes.Count > 0;
}

<tabstrip id="pd-tabs" class="pd-tabs" sm-nav-style="Material" sm-hide-single-item="true" sm-responsive="true">
    @if (Model.FullDescription.Value.HasValue())
    {
        var summary = Model.FullDescription.Value.RemoveHtml().Truncate(300, "...");
        <tab sm-title="@T("Products.Details")" sm-name="pd-full-desc" sm-selected="true">
            <div sm-language-attributes-for="Model.FullDescription" itemprop="description" class="long-text html-editor-content">
                <collapsed-content>
                    @Html.Raw(Model.FullDescription)
                </collapsed-content>
            </div>
        </tab>
    }

    @if (hasSpecificationAttributes)
    {
        <tab sm-title="@T("Products.Specs")" sm-name="pd-spec-attrs" sm-selected="!Model.FullDescription.HasValue()">
            <partial name="Product.Specs" model="Model.SpecificationAttributes" />
        </tab>
    }

    @if (Model.DisplayProductReviews)
    {
        <tab sm-title="@T("Reviews")" 
             sm-name="pd-reviews"
             sm-selected="!Model.FullDescription.HasValue() && !hasSpecificationAttributes" 
             sm-badge-text="@(Model.ReviewCount == 0 ? string.Empty : Model.ReviewCount.ToString())"
             sm-badge-style="Warning">
            <p class="mb-4">
                <a asp-action="Reviews" asp-controller="Product" asp-route-id="@Model.Id" class="btn btn-warning">
                    <span>@T($"Reviews.Overview.{(Model.ProductReviews.TotalReviewsCount > 0 ? "AddNew" : "First")}")</span>
                </a>
            </p>
            <partial name="Product.Reviews" model="Model.ProductReviews" />
        </tab>
    }
</tabstrip>